package com.alipay.mapper;


import com.alipay.model.entity.AccountEntity;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;

/**
 * @author Jun
 */
@Repository
public interface AccountOperationMapper {
    /**
     * 获取余额，具体实现省略
     *
     * @param payAccountId
     * @return
     */
    AccountEntity getBalanceByPayAccountId(String payAccountId);

    /**
     * 扣除金额，版本号实现乐观锁控制, 具体实现省略
     * @param account
     * @param amount
     * @param versionId
     * @return
     */
    boolean decrease(String account, BigDecimal amount, Long versionId);

    /**
     * 增加金额，版本号实现乐观锁控制, 具体实现省略
     * @param account
     * @param amount
     * @param versionId
     * @return
     */
    boolean increase(String account, BigDecimal amount, Long versionId);
}
